<#-- 接口自动校验报告模板优化版 -->

# 接口自动校验报告

- 🕒 生成时间: ${.now?string("yyyy-MM-dd HH:mm:ss")}
- 📊 总行数: ${data?size}
- 🔍 查询列: <#list headers as h>${h}<#if h_has_next>, </#if></#list>

<#if envs?? && envs?size gt 0>
    ## 🌎 环境变量

    <#list envs?keys?sort as k>
        - **${k}**: ${envs[k]!""}
    </#list>
</#if>

---

## ✅ 成功概览（按行）

| Key |<#list headers as h>${h}<#if h_has_next> | </#if></#list> | 通过/总数 |
|:----|<#list headers as h>:---:<#if h_has_next>|</#if></#list>|:---:|
<#list data as r>
    | ${r.key!""} |<#if r.row??><#list r.row as c><#assign ok=(c.status?string=="1")/>${ok?then("✅","❌")} ${c.snippet?replace('\r\n',' ') ?replace('\n',' ') ?replace('\r',' ')!""}<#if c_has_next> | </#if></#list><#else><#list headers as h>-<#if h_has_next> | </#if></#list></#if> | ${r.succeedCnt!0}/${headers?size} |
</#list>

## 📋 详情明细（含摘要）

<#list data as r>
### ${r_index + 1}. Key: ${r.key!""}（通过 ${r.succeedCnt!0}/${headers?size}）

<#if r.row??>
<#list r.row as c>
- **列名**: ${headers[c_index]!""}
- **语句**: ${c.ql!""}
- **状态**: <#if (c.status?string == "1")>通过<#else>失败</#if>
- **摘要**: ${c.snippet!""}
- **结果**:
```json
    ${(c.res?? && c.res.body??)?then(c.res.body?string, "")}
```
</#list>
<#else>
- 无查询列结果
</#if>

</#list>

---

<#-- ✅ 可选调试段落 -->
<#--
## 🧩 调试（原始返回值）
<#list data as r>
#### Key: ${r.key!""}
<#if r.row??>
  <#list r.row as c>
  - ${headers[c_index]!""}: ${c.res?string!""}
  </#list>
<#else>
  - 无
</#if>
</#list>
-->
